﻿using System;
using System.Windows;
using WpfToast.Controls;

namespace WpfToast
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Toast.Show("容器左上角", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerTopLeft, Time = 5000 });
            Toast.Show("容器上中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerTopCenter, Time = 5000 });
            Toast.Show("容器右上角", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerTopRight, Time = 5000 });
            Toast.Show("容器左中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerLeft, Time = 5000 });
            Toast.Show("容器中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerCenter, Time = 5000, Closed = closed, Click = click });
            Toast.Show("容器右中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerRight, Time = 5000 });
            Toast.Show("容器左下角", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerBottomLeft, Time = 5000 });
            Toast.Show("容器下中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerBottomCenter, Time = 5000 });
            Toast.Show("容器右下角", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.OwnerBottomRight, Time = 5000 });

            Toast.Show("屏幕左上角", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenTopLeft, Time = 5000 });
            Toast.Show("屏幕上中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenTopCenter, Time = 5000 });
            Toast.Show("屏幕右上角", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenTopRight, Time = 5000 });
            Toast.Show("屏幕左中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenLeft, Time = 5000 });
            Toast.Show("屏幕中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenCenter, Time = 5000 });
            Toast.Show("屏幕右中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenRight, Time = 5000 });
            Toast.Show("屏幕左下角", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenBottomLeft, Time = 5000 });
            Toast.Show("屏幕下中间", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenBottomCenter, Time = 5000 });
            Toast.Show("屏幕右下角", new ToastOptions { Icon = ToastIcons.Information, Location = ToastLocation.ScreenBottomRight, Time = 5000 });
        }

        private void click(object sender, EventArgs e)
        {
            Toast toast = sender as Toast;
            if (toast == null)
            {
                return;
            }
            toast.Close();
            Console.WriteLine($"===>Click!");
        }

        public void closed(object sender, EventArgs e)
        {
            Console.WriteLine($"===>Closed!");
        }
    }
}
